<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="description" content="This is my page">
<meta http-equiv="expires" content="0">    
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="pragma" content="no-cache">
 		<link href="${pageContext.request.contextPath}/assets/css/bootstrap.min.css" rel="stylesheet" />
        <link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css"/><!--外框-->
        <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/ace.min.css" /><!--提交前图标-->
        <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/font-awesome.min.css" />
        <link href="${pageContext.request.contextPath}/Widget/icheck/icheck.css" rel="stylesheet" type="text/css" />
        <script src="${pageContext.request.contextPath}/js/jquery-1.9.1.min.js"></script>
        <script src="${pageContext.request.contextPath}/assets/js/bootstrap.min.js"></script>
        <script src="${pageContext.request.contextPath}/assets/js/jquery.min.js"></script>
<title>添加商品分类</title>

</head>
<body>
<div class="type_style">
	<div class="type_title" style="text-align:center;">商品类型信息</div>
	<div class="type_content">
		<div class="Operate_btn" style="border:0">
			<a href="javascript:;" class="btn  btn-warning"><i class="icon-edit align-top bigger-100"></i>新增子类型</a>&nbsp;&nbsp;
			<a href="javascript:;" class="btn  btn-success"><i class="icon-ok align-top bigger-125"></i>更新该类型</a>&nbsp;&nbsp;
			<a href="javascript:;" class="btn  btn-danger"><i class="icon-trash   align-top bigger-125"></i>删除该类型</a>
		</div>
		<form id="forlist" action="${pageContext.request.contextPath}/goodsTypeServlet" method="post">
			<input type="hidden" value="getlist" name="opr2">
		</form>
		
		<form action="${pageContext.request.contextPath}/goodsTypeServlet" method="post">
			<input name="opr" type="hidden" value="not_choice">
			<div><input type="text" size="64" value="${reply}" style="text-align:center;border:0;color:red" onfocus="this.blur()"></div>
			<div style="text-align: center;">
				<label class=""><input type="button" value="重置页面" id="showlist"></label>
				</div>
			</div>
			<div style="text-align: center;">
				<c:if test="${list_gt!=null && list_gt.size()>0}">
					<c:set var="max1" value="1"></c:set>
					<c:forEach items="${list_gt}" var="t">
						<c:if test="${max1<=t.good_level}">
							<c:set var="max1" value="${t.good_level}"></c:set>
						</c:if>				
					</c:forEach>
					<c:set var="max" value="${max1}"></c:set>
					<c:forEach begin="0" end="${max}" step="1" varStatus="ss">
					<c:if test="${ss.count<max+1}">
						<select name="goodsType_id" class="types"
							<c:if test="${ss.count!=1}">style="display:none"</c:if>>
							<c:forEach items="${list_gt}" var="t2">
								<c:if test="${ss.count==t2.good_level}">
									<option value="${t2.goodsType_id}" id="${t2.super_type_id}">${t2.name}</option>
								</c:if>
							</c:forEach>
						</select>
					</c:if>
					</c:forEach>
				</c:if>
			</div>
			<div class="Operate_cont clearfix">
				<center>
					<div class="" style="text-align: center;width:300px">
					<label class="form-label" style="width:160px"><span class="c-red">*</span>旧类型名称：</label>
						<input type="text" class="input-text" value="" placeholder="" id="name" name="oname">
					</div>
				</center>
			</div>
			<div class="Operate_cont clearfix">
				<center>
					<div class="" style="text-align: center;width:300px">
					<label class="form-label" style="width:160px"><span class="c-red">*</span>新类型名称：</label>
						<input type="text" class="input-text" value="" placeholder="" id="name" name="nname">
					</div>
				</center>
			</div>
			<div class="Operate_cont clearfix">
				<center>
					<div class="" style="text-align: center;width:300px">
					<label class="form-label" style="width:190px;padding-left:40px"><span class="c-red">*</span>上级类型名称：</label>
						<input type="text" class="input-text" value="" placeholder="" id="fname" name="fname">
					</div>
				</center>
			</div>
			<div class="Operate_cont clearfix">
				<div class="" style=" text-align:center">
					<input style="width:80px" class="btn btn-primary radius" type="submit" value="提交" id="send">
				</div>
			</div>
		</form>	
	</div>
</div> 

<script type="text/javascript" src="${pageContext.request.contextPath}/Widget/icheck/jquery.icheck.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath}/assets/layer/layer.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/H-ui.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath}/js/H-ui.admin.js"></script>
<script type="text/javascript">
	$("#showlist").click(function(){
		$("#forlist").submit();
	});
	var c1=0;
	$(".btn-warning").bind("click",function(){
		if(c1!=1){
			$(".btn-warning").css("border-color","#0048ae");
			$(".btn-success").css("border-color","#87b87f");
			$(".btn-danger").css("border-color","#d15b47");
			$("[name='opr']").val("adda");
			c1=1;
		}
		else{
			$(".btn-warning").css("border-color","#ffb752");
			$("[name='opr']").val("not_choice");
			c1=0;
		}
	});
	$(".btn-success").bind("click",function(){
		if(c1!=2){
			$(".btn-success").css("border-color","#794881");
			$(".btn-warning").css("border-color","#ffb752");
			$(".btn-danger").css("border-color","#d15b47");
			$("[name='opr']").val("update");
			c1=2;
		}
		else{
			$(".btn-success").css("border-color","#87b87f");
			$("[name='opr']").val("not_choice");
			c1=0;
		}
	});
	$(".btn-danger").bind("click",function(){
		if(c1!=3){
			$(".btn-danger").css("border-color","#1ea4b9");
			$(".btn-warning").css("border-color","#ffb752");
			$(".btn-success").css("border-color","#87b87f");
			$("[name='opr']").val("delete");
			c1=3;
		}
		else{
			$(".btn-danger").css("border-color","#d15b47");
			$("[name='opr']").val("not_choice");
			c1=0;
		}
	});
	$.each($(".types"),function(){
		$(this).find("option").each(function(){$(this).css("display:display");});
		$(".types").bind("change",function(){
			$(this).next().css("display","inline");
			var sed = $(this).find("option:selected");
			//var tid = $(sed).attr("id");父id
			var fid = $(sed).val();//子ID
			var next = $(this).find("select").eq(0);
			$.each($(this).find("select").eq(0).find("option"),function(){
				if($(this).attr("id")!=fid)
					$(this).css("display","none");
			});
			//点击上级下级显示
		});
	});
</script>
</body>

</html>